﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Threading.Tasks;
using System.Data.SqlClient;
using DAL;

namespace BLL
{
    public class ForRecommend
    {
        public SqlDataReader ShowRecommend()
        {
            //sql语句
            string sql = string.Format(@"select Book.BookName,Book.Author,Book.Press,BookType.BookType from Book
                         inner join BookClass on BookClass.ClassID = Book.ClassID
                         inner join BookType on Book.BookTypeID = BookType.BookTypeID
                         inner join Books on Book.ID = Books.ID
                         where BookID
                         in (select top 5 BookID from Borrow group by BookID order by count(BookID) desc)");
            SqlDataReader dr = DBHelper.ExecuteReader(sql);
            return dr;
        }
        public void CloseSql()
        {
            DBHelper.ConnectionClose();
        }
    }
}
